<template>
	<view class="content poRel">
		<view class="wid100 " style="height: 338rpx;">
			<image :src="url+'/addon/qianyu_petrol/wxapp/image/fxsq.jpg'" class="wh100"></image>
		</view>
		<view class="wid90 mar mar-top40 borRad20" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.2);">
			<view class="wid90 mar" style="padding: 30rpx 0;">
				<view class="hei20"></view>
				<view class="dis disAl">
					<view class="wid30 foSi35 fowe600" style="text-align: right;"><span style="color: #FE0000;">*</span>姓名：</view>
					<view class="wid70 hei80 dis disAl" style="border-bottom: 1rpx solid #A6A6A6;">
						<input class="textCen foSi30 wid100" v-model="name" placeholder="请输入真实姓名" placeholder-style="color: #A3A3A3;"/>
					</view>
				</view>
				<view class="dis disAl mar-top30">
					<view class="wid30 foSi35 fowe600" style="text-align: right;"><span style="color: #FE0000;">*</span>手机号：</view>
					<view class="wid70 hei80 dis disAl" style="border-bottom: 1rpx solid #A6A6A6;">
						<input class="textCen foSi30 wid100" v-model="phone" type="number" placeholder="请输入手机号码" placeholder-style="color: #A3A3A3;"/>
					</view>
				</view>
				<view class="dis disAl mar-top30">
					<view class="wid30 foSi35 fowe600" style="text-align: right;">邀请码：</view>
					<view class="wid70 hei80 dis disAl" style="border-bottom: 1rpx solid #A6A6A6;">
						<input class="textCen foSi30 wid100" v-model="yaoqing" placeholder="请输入邀请码" placeholder-style="color: #A3A3A3;"/>
					</view>
				</view>
				<view class="borRad40 hei80 dis disAl disJuC mar foSi35 fowe600 coFFF" @click="shenqing"
					style="width: 344rpx;background-color: #37BCC3;margin-top: 60rpx;">申请加入分销商</view>
				<view class="hei20"></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				name: '',
				phone: '',
				yaoqing: ''
			}
		},
		onLoad() {
			var that = this;
			if(uni.getStorageSync('userinfo').identity == "1"){
				that.tiaozhuan('/pages/distribution/distribution')
			}
		},
		methods: {
			shenqing(){
				var that = this;
				if(that.name == ''){					
					uni.showToast({
						title: '请输入姓名',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if(that.phone == ''){					
					uni.showToast({
						title: '请输入手机号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_distribution',
					method: "POST",
					header: {
						'site-id': that.global.site_id, //自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data:{
						name:that.name,
						mobile:that.phone,
						invitation:that.yaoqing
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							uni.showToast({
								title: '成功',
								icon: 'none',
								duration: 2000
							})
						}else{
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
	.content {}
	.xia{
		height: 1rpx;
		background-color: #A6A6A6;
	}
</style>